index.js ➔ constructor   A
last analyzed

Complexity

Conditions 1
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 2
dl 0
loc 7
rs 10
nop 1
1
/* global fetch */
2
import search from './search';
3
import album from './album';
4
5
import API_URL from './config';
6
import toJSON from './utils';
7
8
export default class SpotifyWrapper {
9
  constructor(options) {
10
    this.apiURL = options.apiURL || API_URL;
11
    this.token = options.token;
12
13
    this.album = album.bind(this)();
14
    this.search = search.bind(this)();
15
  }
16
17
  request(url) {
18
    const headers = {
19
      headers: {
20
        Authorization: `'Bearer ${this.token}'`,
21
      },
22
    };
23
24
    return fetch(url, headers).then(toJSON);
25
  }
26
}
27